<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="referrer" content="no-referrer" />
    <title>水面</title>
    <style>
        body {
            position: absolute;
            margin: 0;
            width: 100%;
            height: 100%;
        }

        #mapContainer {
            left: 0px;
            top: 0px;
            width: 100%;
            height: 100%;
            float: left;
        }
    </style>
</head>

<body>
    <div id="mapContainer" style="position: relative;"></div>
</body>
<script src='/GiswayEngine.js'></script>
<script type="text/javascript">
    window.app = new GE.App('mapContainer', {
        position: [120.170646, 30.28362, 1000], //相机的位置
        lookAt: [120.170646, 30.28362, 0], //相机看向的地图位置
        cameraScrollSpeed: 5, //鼠标滚动时，控制相机移动的速度
        minZoom: 3, //允许地图的最小层级
        maxZoom: 18, //允许地图的最大层级
        ambientLightIntensity: 5,
        useDefaultTexture: true, //是否使用瓦片默认纹理
        maxSlopeAngle: 60, //地图最大倾斜角度
        //水面对象会反射Fog，若想避免Fog对反射纹理的影像，背景应设置为Fog以外的类型
        background: "Sky", //背景的类型，参数有如下类型：None, Fog, Color, Gradient, Image, Sky, Image。使用Fog地图的性能会比较好
        baseLayer: [
            //影像底图
            {
                url: ' https://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', //影像底图的url
                // url: 'http://115.236.87.26:8848/googleTiles/china_image/{z}/{y}/{x}.jpg',
                urlDecimal: true, //影像底图url中的瓦片行列号是否是十进制，true表示十进制，false表示十六进制
                tileType: 'image', //影像底图
                canNotSelect: false, //true表示该图层不参与射线拾取，false表示图层参与射线拾取
            }
        ]
    });

    addWater(); //添加水面

    function addWater() {
        let pointArray = [ //3857表示web墨卡托坐标系，4326表示经纬度坐标
            new GE.Point(13376713.90129997, 3540579.2959903134, 0, '3857'),
            new GE.Point(13376711.98134067, 3539826.5375406537, 0, '3857'),
            new GE.Point(13377952.49603797, 3539759.3270052206, 0, '3857'),
            new GE.Point(13378008.185227688, 3540675.3111583497, 0, '3857'),
            // new GE.Point(13377184.375437068, 3540339.2581293588, 0, '3857')
        ];
        let water = new GE.Water({
            points: pointArray,
            color: '#1E90FF', //水面颜色，fffff为透明色
            scale: 0.4, //水纹大小
            reflectivity: 0.02, //反射度【0-1】
            flowX: 1, //X方向水流比例（用于控制水的流动方向）【0-1】
            flowY: 1, //Y方向水流比例（用于控制水的流动方向）【0-1】
            // flowSpeed: 0.08,
            // normalMap0: 'http://192.168.2.100:8701/dev/examples/resources/images/Water_1_M_Normal.jpg',
            // normalMap1: 'http://192.168.2.100:8701/dev/examples/resources/images/Water_2_M_Normal.jpg',
        });
        app.add(water);
    }

    fbx();
    function fbx() {
        model = new GE.OverLay({
            // type: 'fbx',
            // url: 'http://192.168.2.100:8702/resources/1b8b2fcb26b020120aebfac57779e06a/demo1/Build.FBX',
            url:'http://localhost:9000/examples/resources/fbx/Build.FBX',
            position: [120.18995914485937, 30.284443611249923, 0],
            // scale: [100, 100, 100],
            // rotation: [45, 0, 0],
            success: function () {
            }
        })
        app.add(model);
    }

    app.on('Click', function (e) {
        console.log(e)
    });
</script>

</html>